package kr.co.boogui.service;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import kr.co.boogui.dao.MemberDAO;
import kr.co.boogui.model.MemberVO;

public class MemberService {
	
	public static boolean chkMember(HttpServletRequest req) {
		boolean result = false;
		HttpSession sess = req.getSession();
		if (sess.getAttribute("uid")!=null){
			result = true;
		}
		return result;
	}
	
	public static boolean changePwdService(HttpServletRequest req)  {
		boolean result = false;
		String pwd = req.getParameter("c_pwd");
		MemberVO m = new MemberVO();
		m.setPwd(req.getParameter("new_pwd"));
		m.setMno(MemberDAO.chkPwd(pwd));		
		result =  MemberDAO.changePwd(m);			
		return result;
	}
	
	public static  boolean chkPwdService(HttpServletRequest req) {
		boolean result = false;
		String pwd = req.getParameter("c_pwd");
		if (Integer.parseInt(MemberDAO.chkPwd(pwd))>-1) {
			result = true;
		}
		return result;
	}
}
